# with语句(上下文管理器)
'''
with语句可以自动管理上下文资源，不论什么原因跳出with块
都能确保文件正确的关闭，以此来达到释放资源的目的
'''

filePath = 'D:\\hxy\\uploadPath\\bbb.txt'
with open(filePath, 'r') as src_file:
    print(src_file.read())


filePath = 'D:\\hxy\\uploadPath\\abc.png'
#拷贝filePath路径生成图片
copyPath = 'D:\\hxy\\uploadPath\\abc_copy.png'
with open(filePath, 'rb') as one_file:
    with open(copyPath, 'wb') as two_file:
        two_file.write(one_file.read())
